package main;

import gui.MenuBar;
import gui.PrimaryPanel;

import java.util.HashMap;

import javax.swing.JFrame;

import parts.CompositePart;
import parts.APart;
import parts.Part;

public class PartManager {
	public static void main(String[] args) {
		HashMap<String, APart> parts = new HashMap<String, APart>();
		
		APart part = new CompositePart("part1", 0.0);
		if (part.isComposite()) {
			((CompositePart) part).addPart(new Part("subPart1", 20.0));
			((CompositePart) part).addPart(new Part("subPart2", 30.0));
			APart part2 = new CompositePart("subPart3", 0.0);
			((CompositePart) part).addPart(part2);
			((CompositePart) part2).addPart(new Part("subPart1", 10.0));
		}
		
		parts.put(part.getName(), part);
		
		System.out.println(parts.get("part1").getValue());
		
		JFrame frame = new JFrame("BillOfMaterials");
		frame.setSize(800, 600);
		frame.setJMenuBar(new MenuBar());
		frame.add(new PrimaryPanel());
		frame.setVisible(true);
	}
}
